/*
 * Copyright 2017 JessYan
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package me.work.pay.jsyl.mvp.model.api;

import java.util.Map;

import io.reactivex.Observable;
import me.work.pay.jsyl.mvp.model.entity.LauncherData;

import me.work.pay.jsyl.mvp.model.entity.OrderData;
import me.work.pay.jsyl.mvp.model.entity.PayData;
import me.work.pay.jsyl.mvp.model.entity.UpdateInfo;
import retrofit2.http.FieldMap;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.Headers;
import retrofit2.http.POST;
import retrofit2.http.Query;
import retrofit2.http.QueryMap;

/**
 * ================================================
 * 存放一些与 API 有关的东西,如请求地址,请求码等
 * <p>
 * Created by JessYan on 08/05/2016 11:25
 * <a href="mailto:jess.yan.effort@gmail.com">Contact me</a>
 * <a href="https://github.com/JessYanCoding">Follow me</a>
 * ================================================
 */
public interface CommonApi {
    String APP_DOMAIN_NAME = "app";
    //    String APP_DOMAIN = "https://merchant.api.congmingpay.com";
    //merchant.jsyl.com
    String APP_DOMAIN = "https://internal.congmingpay.com";

    String APP_DOMAIN_SEARCH = "http://merchant.congmingpay.com";//查询接口

    String APP_DOMAIN_PAY = "https://pay.congmingpay.com";//支付接口

    String APP_DOMAIN_MINE = "http://mine.congmingpay.com";//支付接口



    String APP_PAY_NAME = "app_pay";
    String APP_MINE_NAME = "app_mine";

    String RequestSuccess = "success";

    /**
     * 初始化操作
     * */
    @GET("/internal/searchaerfinitmsg.do")
    Observable<LauncherData> launcher(@QueryMap Map<String, Object> map);

    /**
     * 查询订单
     * */
    @Headers({"Domain-Name: search"})
    @POST("/merchant/searchorders.do")
    Observable<OrderData> load_order(@QueryMap Map<String, Object> map);

    /**
     * 支付
     * */
    @Headers({"Domain-Name: pay"})
    @POST("/pay/v3/prepay.do")
    @FormUrlEncoded
    Observable<PayData> load_pay(@FieldMap Map<String, Object> map);

    /**
     * 支付
     * */
    @Headers({"Domain-Name: mine"})
    @POST("/mine/uploadlogtoaliyun.do")
    @FormUrlEncoded
    Observable<String> uploadlogtoaliyun(@FieldMap Map<String, Object> map);

    @GET("/internal/searchaerfinitmsg.do")
    Observable<LauncherData> init(@Query("sn") String sn);

    @GET("/internal/version.do")
    Observable<UpdateInfo> check_version(@Query("version") String appVersionName, @Query("type") String ylbapp);
}
